package by.grsu.hdm.devices;

import java.util.ArrayList;
import java.util.List;

import by.grsu.hdm.exceptions.PlayListEmptyException;
import by.grsu.hdm.media.Media;
import by.grsu.hdm.model.IMediaPlayer;

public class MediaPlayer implements IMediaPlayer{
	
	private List<Media> playList;
	
	public MediaPlayer(){
		playList = new ArrayList<Media>();	
	}
	
	public void playMedia(Media media) {
		playList.add(media);
		System.out.println(media.mediaInformation() +" is playing");
	}

	public void playMedia() throws PlayListEmptyException {
		if(!playList.isEmpty()){
			for(Media media : playList)
				System.out.println(media.mediaInformation()+" is playing.");
		} else throw new PlayListEmptyException();
	}

}
